package com.example.back.mapper;

import com.example.back.model.Boardgame;
import com.example.back.model.Scenario;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ScenarioMapper {
    @Select("select * from scenario")
    public List<Scenario> findAllScenario();
    @Select("select * from scenario where lowerLimit<=#{kCount} and upperLimit>=#{kCount}")
    public List<Scenario> selectKCount(int kCount);
    @Select("select * from scenario where instr(name, #{name})>0")
    public List<Scenario> selectKName(String name);
    @Insert("insert into scenario(name, introduction, lowerLimit, upperLimit, position) values(#{name}, #{introduction}, #{lowerLimit}, #{upperLimit}, #{position})")
    public Boolean insertScenario(String name, String introduction, int lowerLimit, int upperLimit, int position);
    @Update("update scenario set position=#{position} where id=#{id}")
    public Boolean updateScenario(int id, int position);
    @Delete("delete from scenario where id=#{id}")
    public Boolean deleteScenario(int id);
    @Select("select photo from scenario where id=#{id}")
    public String findPhotoByID(int id);
}
